package com.saclub.app.fragment;

import java.util.List;

import android.os.Bundle;
import android.view.View;
import butterknife.OnClick;

import com.loopj.android.http.RequestParams;
import com.saclub.app.R;
import com.saclub.app.bean.part.News;
import com.saclub.app.common.Constants.NewsTypeEnum;
import com.saclub.app.common.Constants.SliderTypeEnum;
import com.saclub.app.common.MyPageHelper;
import com.saclub.app.http.ApiRequest;

/**
 * 火星
 * 
 * @author li.li
 *
 */
public class MainTabMarsFragment extends CommonGirdFragment {
	
	@Override
	protected void initView() {
		super.initView();

		//标题
		caller.setTitle(R.string.main_tab_mars_title);
		caller.getToolBar().setBackgroundColor(getResources().getColor(R.color.cl_title_mars));
	}

	@Override
	protected void initData() {

		//轮播图
		RequestParams params = new RequestParams();
		params.put("type_id", SliderTypeEnum.mars.getType());

		ApiRequest.slider.request(this, params);
		ApiRequest.section.request(this, params);

	}

	@OnClick({ R.id.id_gird_item_1, R.id.id_gird_item_2, R.id.id_gird_item_3, R.id.id_gird_item_4, R.id.id_gird_item_5, R.id.id_gird_item_6 })
	public void clickSection(View view) {

		Bundle args = new Bundle();
		args.putString("from", "mars");
		
		News news = null;

		switch (view.getId()) {
		case R.id.id_gird_item_1:
			news = getNewsList().get(0);
			args.putInt("type_id", NewsTypeEnum.type_7.getType());
			MyPageHelper.mainCommonList.showMyPage(getActivity(), args, news.getSectionName());
			break;

		case R.id.id_gird_item_2:
			news = getNewsList().get(1);
			args.putInt("type_id", NewsTypeEnum.type_8.getType());
			MyPageHelper.mainCommonList.showMyPage(getActivity(), args, news.getSectionName());
			break;
		case R.id.id_gird_item_3:
			news = getNewsList().get(2);
			args.putInt("type_id", NewsTypeEnum.type_9.getType());
			MyPageHelper.mainCommonList.showMyPage(getActivity(), args, news.getSectionName());
			break;
		case R.id.id_gird_item_4:
			news = getNewsList().get(3);
			args.putInt("type_id", NewsTypeEnum.type_10.getType());
			MyPageHelper.mainCommonList.showMyPage(getActivity(), args, news.getSectionName());
			break;
		case R.id.id_gird_item_5:
			news = getNewsList().get(4);
			args.putInt("type_id", NewsTypeEnum.type_11.getType());
			MyPageHelper.mainCommonList.showMyPage(getActivity(), args, news.getSectionName());
			break;
		case R.id.id_gird_item_6:
			news = getNewsList().get(5);
			args.putInt("type_id", NewsTypeEnum.type_12.getType());
			MyPageHelper.mainCommonList.showMyPage(getActivity(), args, news.getSectionName());
			break;

		default:
			break;
		}

	}
	
	@Override
	public void onBackPressed() {
	}

}
